package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.parm.SysCancelOrderFeeParm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SysCancelOrderFee;
import com.ruoyi.system.service.ISysCancelOrderFeeService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * cancel_order_fee取消订单手续费Controller
 * 
 * @author ruoyi
 * @date 2024-04-05
 */
@RestController
@RequestMapping("/fee")
public class SysCancelOrderFeeController extends BaseController
{
    @Autowired
    private ISysCancelOrderFeeService sysCancelOrderFeeService;

    /**
     * 查询cancel_order_fee取消订单手续费列表
     */
    @RequiresPermissions("system:fee:list")
    @GetMapping("/list")
    public TableDataInfo list(SysCancelOrderFee sysCancelOrderFee)
    {
        startPage();
        List<SysCancelOrderFee> list = sysCancelOrderFeeService.selectSysCancelOrderFeeList(sysCancelOrderFee);
        return getDataTable(list);
    }

    /**
     * 导出cancel_order_fee取消订单手续费列表
     */
    @RequiresPermissions("system:fee:export")
    @Log(title = "cancel_order_fee取消订单手续费", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysCancelOrderFee sysCancelOrderFee)
    {
        List<SysCancelOrderFee> list = sysCancelOrderFeeService.selectSysCancelOrderFeeList(sysCancelOrderFee);
        ExcelUtil<SysCancelOrderFee> util = new ExcelUtil<SysCancelOrderFee>(SysCancelOrderFee.class);
        util.exportExcel(response, list, "cancel_order_fee取消订单手续费数据");
    }

    /**
     * 获取cancel_order_fee取消订单手续费详细信息
     */
    @RequiresPermissions("system:fee:query")
    @GetMapping(value = "/info")
    public AjaxResult getInfo(@RequestParam(name = "id",required = true) String  id)
    {
        return success(sysCancelOrderFeeService.selectSysCancelOrderFeeById(id));
    }

    /**
     * 新增cancel_order_fee取消订单手续费
     */
    @RequiresPermissions("system:fee:add")
    @Log(title = "cancel_order_fee取消订单手续费", businessType = BusinessType.INSERT)
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody SysCancelOrderFee sysCancelOrderFee)
    {
        return toAjax(sysCancelOrderFeeService.insertSysCancelOrderFee(sysCancelOrderFee));
    }

    /**
     * 修改cancel_order_fee取消订单手续费
     */
    @RequiresPermissions("system:fee:edit")
    @Log(title = "cancel_order_fee取消订单手续费", businessType = BusinessType.UPDATE)
    @PutMapping(value = "/edit")
    public AjaxResult edit(@RequestBody SysCancelOrderFee sysCancelOrderFee)
    {
        return toAjax(sysCancelOrderFeeService.updateSysCancelOrderFee(sysCancelOrderFee));
    }

}
